import React from 'react'
// ===================================================================== global declare
const { $fn, $http, $Lazy, globalConfig:{COVIDUrl} } = window
// ===================================================================== $Lazy
const Tips 					= $Lazy.load(()=>import('#tp/tips'))
const Modal 				= $Lazy.state(()=>import('@antd/modal'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		specCodes:[],
		specCodes2:[]
	}
	submit = {}
	
	open = (uuids,specCodes, specCodes2) => {
		this.submit = {uuids}
		this.setState({specCodes, specCodes2})
		this.modalRef.open()
	}
	render(){
		const { specCodes, specCodes2 } = this.state
		return (
			<Modal
				title	= '审核'
				width 	= {700}
				height  = '40%'
				onRef	= { ref => this.modalRef = ref }
				isFullScroll
				onOk	= {()=>{
					$http.submit(null,COVIDUrl+'caseinfo/reportState',{param:{status:2,...this.submit}}).then(data=>{
						$fn.msg.success('审核成功')
						this.modalRef.close()
						this.props.onRefresh()
					})
				}}
			>
				<div className='h fv p-modal'>
					{$fn.hasArray(specCodes) && <>
						<Tips text='以下条码已超过24小时：' align={0} className='mb5 f14' />
						<div className='f14 mb10'>
							{specCodes.join('，')}
						</div>
					</>}
					{$fn.hasArray(specCodes2) && <>
						<Tips text='以下条码采样时间大于接收时间：' align={0} className='mb5 f14' />
						<div className='f14'>
							{specCodes2.join('，')}
						</div>
					</>}
				</div>
			</Modal>
		)
	}
}

export default Index